<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  Templates.protostar
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
// Getting params from template
$params = JFactory::getApplication()->getTemplate(true)->params;
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$this->language = $doc->language;
$this->direction = $doc->direction;
// Detecting Active Variables
$option   = $app->input->getCmd('option', '');
$view     = $app->input->getCmd('view', '');
$layout   = $app->input->getCmd('layout', '');
$task     = $app->input->getCmd('task', '');
$itemid   = $app->input->getCmd('Itemid', '');
$sitename = $app->getCfg('sitename');
if($task == "edit" || $layout == "form" ){$fullWidth = 1;}
else{$fullWidth = 0;}
// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');
// Add Stylesheets
$doc->addStyleSheet('templates/'.$this->template.'/css/template.css');
// Load optional rtl Bootstrap css and Bootstrap bugfixes
JHtmlBootstrap::loadCss($includeMaincss = false, $this->direction);
// Add current user information

$user = JFactory::getUser();
// Adjusting content width
if ($this->countModules('position-7') && $this->countModules('position-8')){$span = "span6";}
elseif ($this->countModules('position-7') && !$this->countModules('position-8')){$span = "span9";}
elseif (!$this->countModules('position-7') && $this->countModules('position-8')){$span = "span9";}
else{$span = "span12";}
// Logo file or site title param
if ($this->params->get('logoFile')){
	$logo = '<img src="'. JURI::root() . $this->params->get('logoFile') .'" alt="'. $sitename .'" />';
}
elseif ($this->params->get('sitetitle')){
	$logo = '<span class="site-title" title="'. $sitename .'">'. htmlspecialchars($this->params->get('sitetitle')) .'</span>';
}
else{
	$logo = '<span class="site-title" title="'. $sitename .'">'. $sitename .'</span>';
}
$urlpageweb = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
//print_r( $urlpageweb );exit();
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<?php 
	if(	$urlpageweb=="wmcvietnam.com/vn/offers" || 
		$urlpageweb=="wmcvietnam.com/vn/offers/" || 
		$urlpageweb=="http://wmcvietnam.com/vn/offers" || 
		$urlpageweb=="http://wmcvietnam.com/vn/offers/" || 
		$urlpageweb=="http://www.wmcvietnam.com/vn/offers" || 
		$urlpageweb=="http://www.wmcvietnam.com/vn/offers/"){
	?>
    	<meta http-equiv="refresh" content="0; URL=http://wmcvietnam.com/vn/uu-dai">
	<?php }?>
    <?php 
	if(	$urlpageweb=="wmcvietnam.com/en/offers" || 
		$urlpageweb=="wmcvietnam.com/en/offers/" || 
		$urlpageweb=="http://wmcvietnam.com/en/offers" || 
		$urlpageweb=="http://wmcvietnam.com/en/offers/" || 
		$urlpageweb=="http://www.wmcvietnam.com/en/offers" || 
		$urlpageweb=="http://www.wmcvietnam.com/en/offers/"){
	?>
    	<meta http-equiv="refresh" content="0; URL=http://wmcvietnam.com/offers">
	<?php }?>
    
	<jdoc:include type="head" />
	<?php
	if ($this->params->get('googleFont')){
	?>
		<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,700,300&subset=latin,vietnamese' rel='stylesheet' type='text/css'>
		<style type="text/css">
			h1,h2,h3,h4,h5,h6,.site-title{
				font-family: '<?php echo str_replace('+', ' ', $this->params->get('googleFontName'));?>', sans-serif;
			}
		</style>
	<?php
	}
	?>
	<!--[if lt IE 9]>
		<script src="<?php echo $this->baseurl ?>/media/jui/js/html5.js"></script>
	<![endif]-->
	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/protostar/js/jquery.js"></script>
    <script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/protostar/js/jquery.easing.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/protostar/js/jquery.flexslider.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/protostar/js/jquery.carouFredSel.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/protostar/js/custom.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/protostar/js/superfish.js"></script>
	<!--<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/protostar/js/jquery.fancybox.js"></script> 
	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/protostar/css/jquery.fancybox.css" type="text/css" />-->
    <script>
	var _prum = [['id', '532038bfabe53d9339c304da'],
				 ['mark', 'firstbyte', (new Date()).getTime()]];
	(function() {
		var s = document.getElementsByTagName('script')[0]
		  , p = document.createElement('script');
		p.async = 'async';
		p.src = '//rum-static.pingdom.net/prum.min.js';
		s.parentNode.insertBefore(p, s);
	})();
	</script>
	<?php
    $lang=JRequest::getVar('lang','en');
	if($lang=="vi"){
		?>
        <style type="text/css">
        	body{
				font-family:Verdana, Geneva, sans-serif;
			}
			.ourpartners h4, .wmcnews h4, .aboutus h4,.ourporfolio h3{
				font-weight:normal;
			}
        </style>
        <?php
	}
	?> 
    
    <?php
	function IsMobileBrowser()
	{
	   global $_SERVER;
	
	   if (isset($_SERVER['HTTP_X_WAP_PROFILE']))
		  return true;
	   if (isset($_SERVER['HTTP_ACCEPT']))
	   {
		  $userAccept = strtolower($_SERVER['HTTP_ACCEPT']);
		  if (!(stristr($userAccept, 'wap')===FALSE))
			 return true;
	   }
	
	   $userBrowser = strtolower($_SERVER['HTTP_USER_AGENT']);
	   $mobiles = array(
		  "midp", "j2me", "avant", "docomo",
		  "novarra", "palmos", "palmsource",
		  "240x320", "opwv", "chtml",
		  "pda", "windows ce", "mmp/",
		  "blackberry", "mib/", "symbian",
		  "wireless", "nokia", "hand", "mobi",
		  "phone", "cdm", "up.b", "audio",
		  "SIE-", "SEC-", "samsung", "HTC",
		  "mot-", "mitsu", "sagem", "sony"
		  , "alcatel", "lg", "eric", "vx",
		  "NEC", "philips", "mmm", "xx",
		  "panasonic", "sharp", "wap", "sch",
		  "rover", "pocket", "benq", "java",
		  "pt", "pg", "vox", "amoi",
		  "bird", "compal", "kg", "voda",
		  "sany", "kdd", "dbt", "sendo",
		  "sgh", "gradi", "jb", "dddi",
		  "moto", "iphone"
	   );
	   foreach ($mobiles as $value){
		  if (!(stristr($userBrowser, $value)===FALSE))
			 return true;
	   }
	   return false;
	}
	if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPad') == false){
		if(IsMobileBrowser()){ // neu la mobile chuyen link qua mobile
		?>
			<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/protostar/css/mobile.css" type="text/css" />
		<?php
		}
	}
	?>
</head>
<body class="site <?php echo $option
	. ' view-' . $view
	. ($layout ? ' layout-' . $layout : ' no-layout')
	. ($task ? ' task-' . $task : ' no-task')
	. ($itemid ? ' itemid-' . $itemid : '')
	. ($params->get('fluidContainer') ? ' fluid' : '');
?>">
<!-- Body -->
	<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-K7D6GH"
	height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
	<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
	new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
	j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
	'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
	})(window,document,'script','dataLayer','GTM-K7D6GH');</script>
<div class="body">
	<div id="top-bar">
    	<div class="container">
            <jdoc:include type="modules" name="position-2" />
            <jdoc:include type="modules" name="position-3" />
        </div>
    </div>
    <div id="header" class="clearfix">
        <div class="container">
            <div id="logo"> 
            	<jdoc:include type="modules" name="position-8" />
            </div>
            <div class="navigation menutop" id="primary-menu">
				<?php
                if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPad') == false){
                    if(IsMobileBrowser()){ // neu la mobile chuyen link qua mobile
                        if ($this->countModules('position-1')) : 
                ?>
                            <jdoc:include type="modules" name="menumobile" style="none" />
                <?php 
                        endif;
                    }
					else{
                ?>
                    <jdoc:include type="modules" name="position-1" style="none" /><jdoc:include type="modules" name="menumobile" style="none" />
                <?php 
					}
                }
                else{
                ?>
                    <jdoc:include type="modules" name="position-1" style="none" /><jdoc:include type="modules" name="menumobile" style="none" />
                <?php 
                }
                ?>
            </div>
        </div>
    </div>
    <div class="clearfix" id="content">
    	<div class="container">
        	<jdoc:include type="modules" name="breadcrumbs" style="none" />
            <jdoc:include type="modules" name="banner" style="xhtml" />
            <jdoc:include type="message" />
            
            <jdoc:include type="component" />
            <jdoc:include type="modules" name="position-5" style="none" />
            <jdoc:include type="modules" name="position-6" style="none" />
            <jdoc:include type="modules" name="portfolio" style="none" />
            <jdoc:include type="modules" name="position-7" style="none" />
            <div class="border_bottomcontent"></div>
            <!-- Footer -->
            <div class="footer" id="footer">
                <jdoc:include type="modules" name="position-9" />
                <jdoc:include type="modules" name="position-10" />
                <jdoc:include type="modules" name="position-11" />
            </div>
        </div>
    </div>
    
    
    
</div>


<div class="clearfix" id="copyrights">
    <div class="container">
        <div id="foo-left">Copyright &copy; <?php echo date("Y");?>. All rights reserved.</div>
        <div id="foo-right"><jdoc:include type="modules" name="footer" style="none" /></div>
    </div>
</div>



<jdoc:include type="modules" name="debug" style="none" />
</body>
</html>
